<include file="Common:header" />
<body>
<!--面包屑导航 开始-->
<div class="crumb_warp">
    <!--<i class="fa fa-bell"></i> 欢迎使用登陆网站后台，建站的首选工具。-->
    <i class="fa fa-home"></i> <a href="{:U(MODULE_NAME.'/Index/info')}">首页</a> &raquo; 修改密码
</div>
<!--面包屑导航 结束-->

<!--结果集标题与导航组件 开始-->
<div class="result_wrap">
    <div class="result_title">
        <h3>修改密码</h3>
        <!--<notempty name='Think.get.msg'>
            <div class="mark">
                <p>{$Think.get.msg}</p>
            </div>
        </notempty>-->
    </div>
</div>
<!--结果集标题与导航组件 结束-->

<div class="result_wrap">
    <form id="edit_pass_from" method="post">
        <table class="add_tab">
            <tbody>
            <tr>
                <th width="120"><i class="require">*</i>原密码：</th>
                <td>
                    <input type="password" name="password_o" id="password_o"> </i>请输入原始密码</span>
                </td>
            </tr>
            <tr>
                <th><i class="require">*</i>新密码：</th>
                <td>
                    <input type="password" name="password" id="password"> </i>新密码6-20位</span>
                </td>
            </tr>
            <tr>
                <th><i class="require">*</i>确认密码：</th>
                <td>
                    <input type="password" name="password_c" id="password_c"> </i>再次输入密码</span>
                </td>
            </tr>
            <tr>
                <th></th>
                <td>
                    <input type="button" id="button" value="提交">
                    <input type="button" class="back" onclick="history.go(-1)" value="返回">
                </td>
            </tr>
            </tbody>
        </table>
    </form>
</div>
</body>
</html>

<script type="text/javascript">
    $(function() {
                $("#button").click(function () {
                    var password_o = $("#password_o").val();
                    var password = $("#password").val();
                    var password_c = $("#password_c").val();

                    if(password_o==''){
                        layer.msg("请输入原密码！");
                        $("#password_o").focus();
                        return false;
                    }

                    if(password==''){
                        layer.msg("请输入新密码！");
                        $("#password").focus();
                        return false;
                    }

                    if(password.length < 6){
                        layer.msg("新密码必须在6—20位之间！");
                        $("#password").focus();
                        return false;
                    }

                    if(password_c != password){
                        layer.msg("新密码和确认密码不一致！");
                        $("#password_c").focus();
                        return false;
                    }

                    $.post("{:U(MODULE_NAME.'/Index/edit')}", $("#edit_pass_from").serialize(), function(data){
                        if (data.status == 1) {
                            layer.msg(data.info);
                            location.href=location.href;
                        } else {
                            layer.msg(data.info);
                        }
                    });
                });
            });
</script>